package Controller.Menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;

import View.Frame.PrincipalFrame;
import View.Menu.MenuPanel;
import View.Menu.OptionMenu;

public class MenuOptionController {
	private MenuPanel menuPanel_;
	private OptionMenu optionMenu_;
	private PrincipalFrame principalFrame_;
	
	public MenuOptionController(OptionMenu optionMenu, MenuPanel menuPanel, PrincipalFrame principalFrame) {
		menuPanel_ = menuPanel;
		optionMenu_ = optionMenu;
		principalFrame_ = principalFrame;
		optionMenu.addSelectFullScreenActionListener(new SelectFullScreenActionListener());
		optionMenu.addBackActionListener(new BackActionListener());
	}
	
	 private class SelectFullScreenActionListener implements ActionListener{
		 
		 public void actionPerformed(ActionEvent e) {
			 if(optionMenu_.isSelectFullScreen() != false){
				 principalFrame_.setFullScreen();
			 }else{
				 principalFrame_.desetFullScreen();
			 }
		}
	 }
	 private class BackActionListener implements ActionListener{
		 
		 public void actionPerformed(ActionEvent e) {
			principalFrame_.getContentPane().removeAll();
			principalFrame_.addContentPane(menuPanel_);
			principalFrame_.repaint();
			principalFrame_.setVisible(true);
		}
	 }
	 
}
